package com.lz.service;

import com.lz.dao.UserDao;
import com.lz.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService {

    @Autowired
    UserDao userDao;

    public User getById(int id){
        return  userDao.getById(id);
    }

    @Transactional
    public boolean tx(){
          User u1 = new User();
          u1.setId(2);
          u1.setName("ly");
          userDao.insert(u1);
          return true;
    }
}

